import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/3/14 20:07
 */

public class Solution {
    public int searchInsert(int[] nums, int target){
        int left = 0,right = nums.length-1;
        while(left < right){
            int mid = left + (right - left)/2;
            if(nums[mid] < target) left = mid+1;
            else right = mid;
        }
        if(nums[left] < target) return left+1;
        return left;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int size = in.nextInt();
            int[] nums = new int[size];
            for (int i = 0; i < size; i++) {
                nums[i] = in.nextInt();
            }
            int target = in.nextInt();
            Solution solution = new Solution();
            System.out.println(solution.searchInsert(nums, target));
        }
    }
}